home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: ellipses and a front end to sprintf
- Date: 11 Mar 1996 13:34:08 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4i268gINNs4n@keats.ugrad.cs.ubc.ca>
- References: <4hvm2j$9dd@hobbes.cc.uga.edu>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <4hvm2j$9dd@hobbes.cc.uga.edu>,
- Ben Greear <greear@pollux.cs.uga.edu> wrote:
- >
- >I would like to build a function Sprintf that would take as
- >arguments: Sprintf(String& a, String& b, ... );
-
- This is not valid C syntax, unless some pre-processing transformation is
- implied.
-
- >where String is a string class i am coding.
-
- There is no such thing as ``class'' in C. Perhaps you mean ``module'' or
- ``data type''.
-
- >My main question is how to get the "..." arguments to sprintf.
-
- Using the ``stdarg.h'' facilities. These are described in the K&R2 textbook,
- which illustrates their use by demonstrating how to write a miniature printf()
- function.
-
- >can I just call it as: sprintf(a.str, b.str, ...);
-
- No you can't. In fact there is no way to do this using sprintf(). You have to
- use vsprintf()---a version of sprintf that takes a variable-length argument
- list datatype instead of actual parameters.
-
- --
-
-